package top.hmtools.makedata.random;

import java.util.Random;

/**
 * 随机生成字节数组
 * @author HyboWork
 *
 */
public class RandomBytes implements IRandom<byte[]> {
	
	private Random random;
	
	public RandomBytes() {
		this.random = new Random();
	}

	@Override
	public byte[] getRandom() {
		int length = random.nextInt(100);
		return this.getRandom(length);
	}
	
	public byte[] getRandom(int length){
		byte[] result = new byte[length];
		this.random.nextBytes(result);
		return result;
	}

}
